﻿@model EraNet.Core.Model.Account.Member
@{
    Layout = null;
}
<script type="text/javascript">
    $(document).ready(function () {
        /*
        *  Simple image gallery. Uses default settings
        */

        $('.fancybox').fancybox();

        /*
        *  Different effects
        */
});

function submitform() {
    
        var oldPwdVal = $("#oldPwd").val();
        var newPwdVal = $("#newPwd").val();
        var ConfigNewPwdVal = $("#ConfigNewPwd").val();

        var data = "&oldPwd=" + oldPwdVal + "&newPwd=" + newPwdVal + "&ConfigNewPwd=" + ConfigNewPwdVal;
        $.ajax({
            async: false,
            type: "POST",
            url: "/Common/setPassword",
            dataType: "json",
            data: data,
            success: function (data) {
                switch (data) {
                    case "1": alert("原密码不能为空！");
                        break;
                    case "2": alert("新密码不能为空！"); 
                        break;
                    case "3": alert("确认密码不能为空！"); 
                        break;
                    case "4": alert("原密码输入错误！"); 
                        break;
                    case "5": alert("新密码跟确认密码不一致！");
                        break;
                    case "6": alert("更新成功！"); $.fancybox.close('#updPwd');
                        break;
                    default: alert("更新失败!"); 
                        break;
                }

            },
            error: function (XMLHttpRequest, textStatus, errorThrown) {
                alert('请求出现异常，请稍后再试'); 
            }

        });
    }
</script>
<div id="topnav">
@*<a href="#">
<img class="avatar" src="/styles/img/user_32.png" alt="" /></a>*@
<b>用户名：@Model.Names</b>
<span>|</span>  <a class="fancybox" href="#updPwd" >修改密码</a>
<span>|</span> <a href="/Common/LogOffMember">退出</a><br />
</div>


<div id="updPwd" style="display:none">
    <table style="height:100px; width:300px"  border="0">
        <tr>
            <td>原密码：</td>
            <td><input type="password" id="oldPwd" name="oldPwd" /></td>
        </tr>
        <tr>
            <td>新密码：</td>
            <td><input type="password" id="newPwd"  name="newPwd" /></td>
        </tr>
        <tr>
            <td>确认密码：</td>
            <td><input type="password" id="ConfigNewPwd"  name="ConfigNewPwd" /></td>
        </tr>
        <tr>
            <td><input type="submit" id="btnSubmit" value="提交" onclick="submitform()"  name="btnSubmit" /></td>
        </tr>
    </table>
</div>
